/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.message.entity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 系统提示信息Entity
 * @author lvbo
 * @version 2013-07-16
 */
@Entity
@Table(name = "system_notify_message_detail")
@IdClass(SystemNotifyStorePK.class)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class SystemNotifyMessageDetail extends BaseEntity {
	public static final int UNREAD_STATUS= 0;	// 未读
	public static final int READ_STATUS = 1;//已读
	
	private static final long serialVersionUID = 1L;
	private SystemNotifyMessage systemNotifyMessage; 		// 通知消息
	private Store store; 	//门店
	private int status;	//消息状态：0 - 未读1 - 已读
	
	public SystemNotifyMessageDetail() {
	}

	public SystemNotifyMessageDetail(Long id){
		this();
	}
	
	@Id
	@ManyToOne(cascade={CascadeType.REFRESH},fetch = FetchType.LAZY)
	@JoinColumn(name="snm_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public SystemNotifyMessage getSystemNotifyMessage() {
		return systemNotifyMessage;
	}

	public void setSystemNotifyMessage(SystemNotifyMessage systemNotifyMessage) {
		this.systemNotifyMessage = systemNotifyMessage;
	}
	
	@Id
	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="store_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
}